package banking;
public class Customer {
    private Account account;// 客户关联的银行账户
    private String firstName;// 客户名字
    private String lastName;// 客户姓氏

    public Customer(String f, String l) {
        firstName = f; // 设置名字
        lastName = l;// 设置姓氏
    }

    public String getFirstName() {
        return firstName;// 返回名字
    }

    public String getLastName() {
        return lastName;// 返回姓氏
    }

    public Account getAccount() {
        return account;// 返回关联的账户对象
    }

    public void setAccount(Account acct) {
        account = acct;// 设置/关联一个账户给客户
    }

    // 添加 main 方法用于测试
    public static void main(String[] args) {
        // 创建客户
        Customer customer = new Customer("吴", "勇");
        System.out.println("客户姓名: " + customer.getFirstName() + " " + customer.getLastName());

        // 创建账户并关联到客户
        Account account = new Account(1500.0);
        customer.setAccount(account);

        // 测试账户功能
        System.out.println("初始余额: " + customer.getAccount().getBalance());

        customer.getAccount().deposit(45);
        System.out.println("存款 45 后余额: " + customer.getAccount().getBalance());

        boolean ok = customer.getAccount().withdraw(900);
        System.out.println("取款 900 是否成功: " + ok + "，余额: " + customer.getAccount().getBalance());
    }
}